
const ADMIN = 'admin'
const userMap = {
  admin: {
    code: 0,
    message: '操作成功-mock',
    data: {
      name: '测试公司',
      mobile: '13049352358',
      fleetId: null,
      lspId: null,
      lspName: null,
      roleId: 4,
      fleets: null,
      lspInfos: null,
      role: null
    }
  }
}

const loginMap = {
  admin: {
    code: 0,
    message: '操作成功-mock',
    data: {
      access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJnbXRfY3JlYXRlIjoiMTU2NzA2NzQyNDQ2MCIsImFjY291bnRJZCI6MTksInVzZXJfbmFtZSI6ImxpYW5ncGVuZ0B1bmxjbi5jb20iLCJzY29wZSI6WyJhbGwiXSwicm9sZXMiOlt7ImF1dGhvcml0eSI6IlJPTEVfQURNSU4ifV0sInRlbmFudElkIjoxLCJjb3JwTmFtZSI6IuS4reiBlOeJqea1ge-8iOS4reWbve-8ieaciemZkOWFrOWPuCIsImV4cCI6MTU2NzA3NDYyNCwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJjMmU0ZjA0NS1lN2M1LTQ1NGEtYWQ1Ny01ODJhOTQyNDY2ZjEiLCJjbGllbnRfaWQiOiJkZXZvcHMiLCJ1c2VybmFtZSI6ImxpYW5ncGVuZ0B1bmxjbi5jb20ifQ.dv0Yb3yaq44TQrlM-4N0oSGVSkj9ZDHfZthU77JLcHw',
      'token_type': 'bearer',
      'refresh_token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJnbXRfY3JlYXRlIjoiMTU2NzA2NzQyNDQ2MCIsInVzZXJfbmFtZSI6ImxpYW5ncGVuZ0B1bmxjbi5jb20iLCJyb2xlcyI6W3siYXV0aG9yaXR5IjoiUk9MRV9BRE1JTiJ9XSwiY29ycE5hbWUiOiLkuK3ogZTnianmtYHvvIjkuK3lm73vvInmnInpmZDlhazlj7giLCJhdXRob3JpdGllcyI6WyJST0xFX0FETUlOIl0sImNsaWVudF9pZCI6ImRldm9wcyIsImFjY291bnRJZCI6MTksInNjb3BlIjpbImFsbCJdLCJhdGkiOiJjMmU0ZjA0NS1lN2M1LTQ1NGEtYWQ1Ny01ODJhOTQyNDY2ZjEiLCJ0ZW5hbnRJZCI6MSwiZXhwIjoxNTY5NjU5NDI0LCJqdGkiOiI3MzdiMDRhNC04YTQzLTQ5M2UtYmM4Ny1mZWEyMzIxODVlNTQiLCJ1c2VybmFtZSI6ImxpYW5ncGVuZ0B1bmxjbi5jb20ifQ.-p-8edfUGdDFz7AIAYvnI6erDfjJ59KWSuoefW_XkD4',
      'expires_in': 7200,
      'scope': 'all',
      'gmt_create': '1567067424460',
      'accountId': 19,
      'roles': [{
        'authority': 'ROLE_ADMIN'
      }],
      'tenantId': 1,
      'corpName': '中联物流（中国）有限公司',
      'username': 'liangpeng@unlcn.com',
      'jti': 'c2e4f045-e7c5-454a-ad57-582a942466f1'
    }
  }
}

export default {
  login: config => {
    // const { username } = JSON.parse(config.body)
    // console.log('mock-login-config', config)
    return loginMap[ADMIN].data
  },
  queryUserInfo: config => {
    // const { username } = param2Obj(config.url)
    // console.log('mock-queryUserInfo-config', config)
    return userMap[ADMIN]
  },
  logout: () => 'success'
}
